package com.adong.mapper;

import com.adong.domain.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author com.adong
 */
public interface UserMapper {
    @Select("select * from user where id = #{id} ")
    User findById(Integer id);

    @Insert("insert into user values(#{id},#{username},#{password})")
    void save(User user);

    @Update("update user set username=#{username},password=#{password} where id=#{id}")
    void update(User user);

    @Delete("delete from user where id=#{id}")
    void delete(int id);

    @Select("select * from user")
    List<User> findAll();

}
